<?php
//将一个或者多个单元压入到数组的末尾，这是传址操作
//array_push
//$users = ['向军大叔','小明'];
//array_push($users,'张三');
//print_r($users);

//array_pop
//出栈
//array_pop($users);
//print_r($users);

//array_shift($users);
//print_r($users);

//给数组的开头插入一个或者多个单元
//array_unshift($users,'后盾人');
//print_r($users);

//echo count($users);

//检查数组中是否存在某个值
//$allowImageType = ['jpeg','jpg','png'];
//$file = 'hdcms.jpg';
//$ext = trim(strchr($file,'.'),'.');
//$ext = strtolower($ext);
//if(!in_array($ext,$allowImageType)){
//    echo 'is_wrong';
//}else{
//    echo 'yes';
//}

//array_key_exists  检查数组中是否有指定的键名或者索引
$allowImageType = ['jpeg'=>2000000,'jpg'=>200000,'png'=>200000];
$file = 'hdcms.txt';
$ext = strtolower(substr(strchr($file,'.'),1));


//检查数组中是否有指定的键值
//if(!array_key_exists($ext,$allowImageType)){
//    echo 'no';
//}else{
//    echo 'yes';
//}
$keys = array_keys($allowImageType);
var_dump($keys);
//
//if(!in_array($ext,array_keys($allowImageType))){
//    echo '没有知找到匹配的键';
//}else{
//    echo '已经找到匹配的键';
//}
